import 'package:flutter/material.dart';

import 'package:flutter/cupertino.dart';
import 'package:wanke/index.dart';
import 'function.dart';

void main() async{
  Color mainColor=await themeColor;
  runApp(WankeApp(mainColor));
}

class WankeApp extends StatefulWidget {
  WankeApp(this.mainColor);
  Color mainColor;
  @override
  WankeAppState createState() {
    return new WankeAppState();
  }
}

class WankeAppState extends State<WankeApp>{
  Color mainColor = Colors.deepOrange;
  @override
  void initState() {
    super.initState();
    setTheme();
  }

  setTheme() {
    themeColor.then((color) {
      mainColor = color;
      setState(() {});
    });
  }
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: '玩客随行',
      home: new Index(),
      theme: new ThemeData(
        accentColor: widget.mainColor,
        primaryColor: widget.mainColor,
      ),
    );
  }
}

